package com.alalei.moodview;

import android.graphics.Color;
import android.os.Bundle;

import androidx.appcompat.app.AppCompatActivity;

import com.github.mikephil.charting.charts.LineChart;
import com.github.mikephil.charting.data.LineDataSet;

import java.util.ArrayList;
import java.util.List;
import java.util.Random;

public class MainActivity extends AppCompatActivity {

    private LineChart chart, chart2;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        chart = findViewById(R.id.chart1);
        chart2 = findViewById(R.id.chart2);

        List<MoodChartBean> moodChartBeanList = new ArrayList<>();
        Random random = new Random();
        for (int i = 0; i < 12; i++) {
            MoodChartBean moodChartBean = new MoodChartBean();
            moodChartBean.setSmile(random.nextInt(10));
            moodChartBean.setCry(random.nextInt(10));
            moodChartBeanList.add(moodChartBean);
        }

        MoodChart.getInstance(this).initLineChart(chart);
        MoodChart.getInstance(this).initLineChart(chart2);

        LineDataSet lineDataSet1 = MoodChart.getInstance(this).addLineChartSmlie(chart, moodChartBeanList, null, Color.parseColor("#F77979"));
        LineDataSet lineDataSet2 = MoodChart.getInstance(this).addLineChartCry(chart, moodChartBeanList, null, Color.parseColor("#6174FF"));
        MoodChart.getInstance(this).showLineChart(chart, lineDataSet1, lineDataSet2);
    }


}
